
set(utils_SRCS
  util/log.c
  util/md5.c
  util/time_wheel.c
  util/url.c
  util/util.c
)

set(win_SRCS
  windows/net/async_task_queue.c
  windows/net/buffer.c
  windows/net/channel.c
  windows/net/inetaddr.c
  windows/net/loop.c
  windows/net/socket.c
  windows/net/tcp_client.c
  windows/net/tcp_connection.c
  windows/net/tcp_server.c
  windows/net/timer_queue.c
  windows/net/udp_peer.c
)

set(linux_SRCS
  linux/net/async_task_queue.c
  linux/net/buffer.c
  linux/net/channel.c
  linux/net/inetaddr.c
  linux/net/loop.c
  linux/net/socket.c
  linux/net/tcp_client.c
  linux/net/tcp_connection.c
  linux/net/tcp_server.c
  linux/net/timer_queue.c
  linux/net/udp_peer.c
)

set(rtsp_rtp_SRCS
    rtsp/rtsp_message_codec.c
    rtsp/rtsp_request.c
    rtsp/rtsp_server.c
    rtsp/rtsp_session.c
    rtsp/sdp.c
    rtp/rtp_peer.c
)

set(ssl_SRCS
  ssl/dtls_endpoint.c
  ssl/tls_client.c
)

set(tinylib_SRCS
    ${utils_SRCS}
)

if (MSVC)
    list(APPEND tinylib_SRCS ${win_SRCS})
elseif (UNIX)
    list(APPEND tinylib_SRCS ${linux_SRCS})
endif()

if (OpenSSL_FOUND)
    list(APPEND tinylib_SRCS ${ssl_SRCS})
endif()

if (BUILD_RTSP_RTP)
    list(APPEND tinylib_SRCS ${rtsp_rtp_SRCS})
endif()

add_library(tinylib STATIC ${tinylib_SRCS})
